//
//  JWChooseRCell.m
//  test
//
//  Created by 李彦宏 on 2018/3/2.
//  Copyright © 2018年 朱圳. All rights reserved.
//

#import "JWChooseRCell.h"
#define black [UIColor blackColor]
#define Fsize [UIFont fontWithName:@"Black" size:15]
@implementation JWChooseRCell



//类方法快速创建cell
+(instancetype)cellwithTableview:(UITableView *)tableview{
    
    // 1.创建cell
    static NSString *ID = @"cell123";
    JWChooseRCell *cell = [tableview dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[JWChooseRCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
    }
    return  cell;
    
}
/**
 *  cell的初始化方法，一个cell只会调用一次
 *  一般在这里添加所有可能显示的子控件，以及子控件的一次性设置
 */
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        //添加UI控件
        [self setUI];
    }
    return self;
}
-(void)setUI{
    UILabel *lb1=[[UILabel alloc]init];
    lb1.text=@"姓名:";
    lb1.textColor=black;
    lb1.textAlignment=NSTextAlignmentCenter;
    lb1.font=Fsize;
    [self.contentView addSubview:lb1];
    
    UILabel *lb2=[[UILabel alloc]init];
    lb2.text=@"Myname";
    lb2.textColor=black;
    lb2.textAlignment=NSTextAlignmentCenter;
    lb2.font=Fsize;
    self.namelab=lb2;
    [self.contentView addSubview:lb2];
    
    UILabel *lb3=[[UILabel alloc]init];
    lb3.text=@"专业:";
    lb3.textColor=black;
    lb3.textAlignment=NSTextAlignmentCenter;
    lb3.font=Fsize;
    [self.contentView addSubview:lb3];
    
    UILabel *lb4=[[UILabel alloc]init];
    lb4.text=@"专业是XXX";
    lb4.textColor=black;
    lb4.textAlignment=NSTextAlignmentCenter;
    lb4.numberOfLines=0;
    lb4.font=[UIFont systemFontOfSize:14];
    self.profession=lb4;
    [self.contentView addSubview:lb4];
    
    UIButton *bt1=[[UIButton alloc]init];
    [bt1 setTitle:@"分配" forState:UIControlStateNormal];
    [bt1 setTitleColor:black forState:UIControlStateNormal];
    [bt1 setBackgroundColor:dominantColor];
    bt1.layer.cornerRadius=4;
    self.distribute=bt1;
    [self.contentView addSubview:bt1];
    
    NSInteger Enging = 6;
    
    [lb1 mas_makeConstraints:^(MASConstraintMaker *make) {
    make.left.equalTo(self.contentView.mas_left).offset(6);
    make.top.equalTo(self.contentView.mas_top).offset(6);
make.bottom.equalTo(self.contentView.mas_bottom).offset(6);

    }];
    [lb2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(lb1.mas_right).offset(3);
        make.centerY.equalTo(lb1);
    }];
    [lb3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(lb2.mas_right).offset(Enging);
        make.centerY.equalTo(lb1);
    }];
    [bt1 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.equalTo(lb1);
        make.width.mas_equalTo(45); make.right.equalTo(self.contentView.mas_right).offset(-Enging);
    }];
    [lb4 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(lb3.mas_right).offset(3);
        make.top.equalTo(self.contentView.mas_top).offset(0);
        make.bottom.equalTo(self.contentView.mas_bottom).offset(0);
        make.right.equalTo(bt1.mas_left).offset(-5);
       
    }];
   
    
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
